﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exerciseTen
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一组数字,以空格分开：");
            string str = Console.ReadLine();
            string[] strnumber = str.Split(' ');
            int length = strnumber.Count();
            int[] number = new int[length];
            for (int i = 0; i < length; i++)
            {
                number[i] = Convert.ToInt32(strnumber[i]);
            }
            //排序
            int temp = 0;
            for (int i = length-1; i > 0; i--)
            {
                for (int j = 0; j < i; j++)
                {
                    if (number[j] > number[j + 1])
                    {
                        temp = number[j + 1];
                        number[j + 1] = number[j];
                        number[j] = temp;
                    }
                }
            }
            Console.WriteLine("从小到大的排序结果：");
            for (int i = 0; i < 10; i++)
            {
                Console.Write(number[i] + " ");
            }
            Console.ReadLine();
        }
    }
}
